package com.gw.base;

import com.gw.common.model.Information;
import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

public class informationValidator extends Validator{
	@Override
	protected void validate(Controller c) {
		validateRequired("information.INFORMATIONTITLE", "INFORMATIONTITLEMsg", "请输入标题");
		validateRequired("information.INFORMATIONSUBTITLE", "INFORMATIONSUBTITLEMsg", "请输入内容");
	}

	@Override
	protected void handleError(Controller c) {
		c.keepModel(Information.class);
//		c.render("add.html");
		String actionKey = getActionKey();
		if (actionKey.equals("/information/save"))
			controller.render("add.html");
		else if (actionKey.equals("/information/update"))
			controller.render("edit.html");
	}
}
